﻿/*
 * FileName: Toss.cs
 * Module: Independent Modules
 * Author: Gourav Das
 * Created: 04/2011
 * Modifications:
 * Copyright: Gourav Das, 2011
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using _22yards.Core;

namespace _22yards.IndependentModules
{
    /// <summary>
    /// Class to help decide outcome of Toss
    /// </summary>
    public class Toss
    {
        /// <summary>
        /// Decides on outcome of Toss and Sets the values appropriately in the respective team.
        /// </summary>
        /// <param name="callingTeam">The calling team.</param>
        /// <param name="nonCallingTeam">The non calling team.</param>
        /// <param name="call">The call. 0 for heads and 1 for tails</param>
        public static void Call(ref Team callingTeam, ref Team nonCallingTeam, int call)
        {
            Random rnd = new Random(0);
            
            if (rnd.Next(0, 1) == call)
            {
                callingTeam.TossWinner = true;
                nonCallingTeam.TossWinner = false;
            }
            else
            {
                nonCallingTeam.TossWinner = true;
                callingTeam.TossWinner = false;
            }
        }
    }
}
